-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix: Fix Windows Cross-Compilation #2234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Duplicate of #2204. |
This is not vcpkg. And seems like this error happens with many tools. So I think it should be fixed. |
So check whether the variable is set and print a warning message is the right way for handling cross-compilation. |
Yes, it should be fixed in the lib. |
@sum01 @jimmy-park could you please review this pull request? Thanks! |
CMakeLists.txt
Outdated
message(SEND_ERROR "Windows ${CMAKE_SYSTEM_VERSION} or lower is not supported. Please use Windows 10 or later.") | ||
endif() | ||
else() | ||
message(WARNING "The target is Windows but CMAKE_SYSTEM_VERSION is not set, the default system version is set to Windows 10 or later.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually setting a default system version anywhere? I don't remember it being in the Cmake at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMake >= 3.24 on Windows ignores this variable and always finds the latest version of the SDK, so no need to set it.
For version < 3.24, we can use set(CMAKE_SYSTEM_VERSION "10.0.19041.0")
. Users can also pass values from command lines to it.
I added it. @sum01 PTAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for that specific version? Just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for that specific version? Just curious.
The version 10.0.19041.0 is for Windows10 20H1 (ver 2004) and later. This should include most Windows 10 instances which still in running.
b90ed64
to
e6a7c89
Compare
Thanks all! |
When cross-compiling for Windows systems, CMake will report an error because the CMAKE_SYSTEM_VERSION variable has not been set:
Checking whether this variable has been set resolves the error. A warning message is specifically output for this situation.